<?php
/**
  *  Project name: project_name
  *  Created on: 08.12.2011
  *  Author: Kai R�der
  */
/**********************************************
 * 
 * Database configuration
 * 
 **********************************************/
if(!$sql)
{
    include("../../class/sql/class.sql.php");
    $connArgs = array(
                                            "mysql:host=localhost;dbname=kssystem", // Connection
                                            "kssystem", 							// User
                                            "foobar",									// Password
                                            array()								// Options
                                    );

    // Connection handle
    $sql = new CSql($connArgs);

    // Set db-charset to utf8
    $sql->query("SET NAMES utf8");
    $sql->query("SET CHARACTER SET utf8");
}



$idZentrale = $_GET['idZentrale'];
if(!$idZentrale) $idZentrale = $eIdZentrale;


$bezirk = $sql->prepare("SELECT * FROM Bezirk WHERE zentraleId = ?");
$bezirk->execute(array($idZentrale));


$options = "";

$options.= "<option value='null'>Keine Auswahl</option>";
foreach($bezirk as $b)
{
    if($eIdBezirk == $b['idBezirk']) { $checked = "selected='selected'"; } else { unset($checked); }
    $options.= "<option value='" . $b['idBezirk'] . "' $checked>[" . $b['kurzel'] . "] " . utf8_decode($b['bezeichnung']) . "</option>";
}
echo $options;
?>